import Loading from "./Loading.vue";
import Vue from 'vue';

//创建loading组件构造函数
const LoadingConstructor = Vue.extend(Loading);

const serve = () => {
    //创建loading实例
    let loadingInstance = new LoadingConstructor();
    //挂载loading组件到指定元素
    loadingInstance.$mount(document.createElement('div'));
    //将组件挂载的元素添加到body
    document.body.appendChild(loadingInstance.$el);

    Vue.nextTick(() => {
        loadingInstance.visible = true;
    })
    
    return loadingInstance
    
}

export default serve;
